<?php
    $arr_subsistemas = array(
        'TX' => 'Transmision',
        'COM' => 'Comunidad',
        'Home' => 'Pagina Principal',
        'SAI' => 'Sistema de administracion interno'
    );
    $arr_estados = array(
        1 => 'Reportado',
        2 => 'Aceptado',
        3 => 'Trabajando',
        4 => 'Resuelto',
        5 => 'Cerrado',
        6 => 'Anulado'
    );
    $arr_tipos = array(
        1 => 'Mal funcionamiento',
        2 => 'Sugerencia',
        3 => 'Critica'
    );
?>
<header>
    <div class="title">
        <a href=""><span class="icon user"></span>Servicio tecnico</a> <span class="icon chevron-right"></span> <strong>Ver reporte</strong>
    </div>
    <div class="shortcuts">
        <a href=""></a>
    </div>
    <div class="help">
        <a href="">Ayuda</a>
    </div>
</header>
<div class="sidebar">
    <div id="service-read" class="content">
        <h2><span class="icon add-user"></span> Ver reporte</h2>
        <form id="service-read-form" action="#" method="post" enctype="multipart/form-data">
            <input name="form-action" type="hidden" value="read-service" />
            <div class="form-fields">
                <label>
                    <span class="name">Titulo:</span>
                    <input readonly type="text" name="titulo" value="<?php if ($service->get('reportes','titulo')) echo html_entity_decode($service->get('reportes','titulo')); ?>" id="service-read-form-titulo" placeholder="Sin datos" />
                    <span class="help" data-text="Depending on project settings weekend may be included in due date calculation"></span>
                </label>
                <div class="double">
                    <label>
                        <span class="name">Subsistema:</span>
                        <input readonly type="text" name="subsistema" value="<?php if ($service->get('reportes','subsistema')) echo $arr_subsistemas[$service->get('reportes','subsistema')]; ?>" id="service-read-form-subsistema" placeholder="Sin datos" />
                        <span class="help" data-text="Depending on project settings weekend may be included in due date calculation"></span>
                    </label>
                    <label>
                        <span class="name">Tipo:</span>
                        <input readonly type="text" name="tipo" value="<?php if ($service->get('reportes','tipo')) echo $arr_tipos[$service->get('reportes','tipo')]; ?>" id="service-read-form-tipo" placeholder="Sin datos" />
                        <span class="help" data-text="Depending on project settings weekend may be included in due date calculation"></span>
                    </label>
                </div>
                <label>
                    <span class="name">Estado:</span>
                    <input readonly type="text" name="estado" value="<?php if ($service->get('reportes','estado')) echo $arr_estados[$service->get('reportes','estado')]; ?>" id="service-read-form-estado" placeholder="Sin datos" />
                    <span class="help" data-text="Depending on project settings weekend may be included in due date calculation"></span>
                </label>
                <label>
                    <span class="name">Descripcion:</span>
                    <textarea disabled name='descripcion' id="service-read-form-descripcion"><?php if ($service->get('reportes','descripcion')) echo html_entity_decode($service->get('reportes','descripcion')); ?></textarea>
                    <span class="help" data-text="Depending on project settings weekend may be included in due date calculation"></span>
                </label>
                </div>
            </div><br>
            <div class="form-buttons">
                <a class="button important blue" href="<?php echo $host .'services/add-note/'.$glb_uri[2] ?>">Agregar nota</a>
                <a class="button important red" href="<?php echo $host .'services/' ?>">Ir a listado</a>
            </div>
            <?php if (isset($arr_notes) && count($arr_notes)) { ?>
                <h2>Listado de notas</h2>
                <?php foreach($arr_notes as $note) { ?>
                    <div class="form-fields">
                        <div class="double">
                            <label>
                                <span class="name">Origen:</span>
                                <input readonly type="text" value="<?php if ($note['origen'] == 1) echo 'Vos'; ?>" />
                                <span class="help" data-text="Depending on project settings weekend may be included in due date calculation"></span>
                            </label>
                            <label>
                                <span class="name">Fecha:</span>
                                <input readonly type="text" value="<?php echo date('d/m/Y H:i:s',$note['fecha']); ?>" />
                                <span class="help" data-text="Depending on project settings weekend may be included in due date calculation"></span>
                            </label>
                        </div>
                        <label>
                            <span class="name">Nota:</span>
                            <textarea disabled><?php echo html_entity_decode($note['mensaje']); ?></textarea>
                            <span class="help" data-text="Depending on project settings weekend may be included in due date calculation"></span>
                        </label>
                    </div> <br>
                <?php } ?>
            <?php } ?>
        </form>
    </div>
</div>
